package com.unisal.java;

import java.util.Iterator;

public class Garconete {
	MenuComponente allMenus;

	public Garconete(MenuComponente allMenus) {
		this.allMenus = allMenus;
	}

	public void imprimeMenu() {
		allMenus.print();
	}
	
	public void imprimeMenuVegetariano() {
		Iterator iterator = allMenus.criaIterador();

		System.out.println("\nVEGETARIAN MENU\n----");
		while (iterator.hasNext()) {
			MenuComponente menuComponent = 
					(MenuComponente)iterator.next();
			try {
				if (menuComponent.isVegetariano()) {
					menuComponent.print();
				}
			} catch (UnsupportedOperationException e) {}
		}
	}

}
